package com.qk.mapper;

import com.qk.dto.CourseDto;
import com.qk.entity.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CourseMapper {
    @Delete("delete from course where id=#{id}")
    void delete(Integer id);

    List<Course> selectall(CourseDto coursedto);

    @Insert("insert into course(subject,name,price,target,description,create_time,update_time) values(#{subject},#{name},#{price},#{target},#{description},#{createTime},#{updateTime})")
    void add(Course course);

    @Select("select id,subject,name,price,target,description,create_time,update_time from course where id= #{id}")
    Course getById(Integer id);

    void update(Course course);

    @Select("select * from course")
    List<Course> all();

    @Select("select * from course where subject=#{subject}")
    List<Course> getBysubject(Integer subject);
}
